package com.zhidisoft.crm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.zhidisoft.crm.entity.SysFunction;

public interface ISysfuncMapper {
	/**
	 * 查询所有菜单
	 * @return
	 */
	@Select("select * from sys_function")
	List<SysFunction> findAll();
	
	@Select("select * from sys_function limit #{pageNum},#{pageSize}")
	List<SysFunction> pageList(@Param("pageNum")Integer pageNum, @Param("pageSize")Integer pageSize);

	@Select("select count(id) from sys_function")
	Integer totalCount();
	
	
	/**
	 * 添加菜单
	 * @param func
	 */
	@Insert("insert into sys_function(id,func_code,func_name,func_type,func_url,parent_id)values(#{id},#{func_code},#{func_name},#{func_type},#{func_url},#{parent_id})")
	void save(SysFunction func);
	/**
	 * 根据id删除菜单
	 * @param id
	 */
	@Delete("delete from sys_function where id=#{id}")
	void deleteById(String id);
	/**
	 * 修改菜单
	 * @param func1
	 */
	@Update("update sys_function set func_code=#{func_code},func_name=#{func_name},func_type=#{func_type},func_url=#{func_url},parent_id=#{parent_id}where id=#{id}")
	void update(SysFunction func1);
	
	
}
